Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

TL;DR

Added a new GridError schema and improved error handling in the OpenAPI specification.

What changed?

  • Created a new GridError schema to standardize error responses
  • Added additionalProperties: true to all error schema details objects to allow for flexible error details
  • Refactored BulkCustomerImportErrorEntry to extend from GridError instead of using a nested error structure
  • Updated webhook response schemas to reference GridError instead of Error

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

Introduced a new GridError schema to standardize error responses and improve flexibility across the API. The changes add additionalProperties: true to all error schema details objects, allowing for extensible error metadata.

Key Changes:

  • Created GridError schema with code, message, and flexible details object
  • Refactored BulkCustomerImportErrorEntry to extend GridError using allOf composition instead of nested error structure
  • Updated webhook response schemas (IncomingPaymentWebhookForbiddenResponse, IncomingPaymentWebhookUnprocessableResponse) to reference GridError instead of the old Error schema
  • Added additionalProperties: true to details field in all HTTP error schemas (400, 401, 403, 404, 409, 412, 424, 500, 501)

Impact:
This change improves API flexibility by allowing error responses to include arbitrary additional details without breaking the schema contract. The refactoring of BulkCustomerImportErrorEntry improves reusability and maintainability by using composition with the base GridError schema.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are purely additive to the OpenAPI schema and improve error handling flexibility. The new GridError schema maintains backward compatibility by preserving the same structure as the old Error schema while adding additionalProperties: true to details objects. The refactoring of BulkCustomerImportErrorEntry improves maintainability without changing the effective schema contract. All changes are mechanical schema updates with no logic changes.
  • No files require special attention

Important Files Changed

Filename Overview
openapi/components/schemas/common/GridError.yaml Created new GridError schema with additionalProperties on details object
openapi/components/schemas/customers/BulkCustomerImportErrorEntry.yaml Created new schema extending GridError with correlationId field
openapi/components/schemas/customers/BulkCustomerImportJob.yaml Refactored errors array to use BulkCustomerImportErrorEntry instead of inline schema
openapi/components/schemas/errors/Error400.yaml Added additionalProperties: true to details object
openapi/components/schemas/webhooks/IncomingPaymentWebhookForbiddenResponse.yaml Updated to reference GridError instead of Error
openapi/components/schemas/webhooks/IncomingPaymentWebhookUnprocessableResponse.yaml Updated to reference GridError instead of Error

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant Schema as Error Schema

    Note over Client,Schema: Error Response Flow

    Client->>API: API Request (invalid input)
    API->>Schema: Validate against Error400 schema
    Schema->>Schema: code, message, status (required)
    Schema->>Schema: details (additionalProperties: true)
    API->>Client: Return Error400 response

    Note over Client,Schema: Bulk Import Error Flow

    Client->>API: POST /bulk-import
    API->>API: Process import entries
    API->>Schema: Create BulkCustomerImportErrorEntry
    Schema->>Schema: Extend GridError (code, message, details)
    Schema->>Schema: Add correlationId (required)
    API->>Client: Return errors array with BulkCustomerImportErrorEntry[]

    Note over Client,Schema: Webhook Error Flow

    Client->>API: Webhook callback
    API->>Schema: Validate and prepare webhook response
    Schema->>Schema: Use GridError base schema
    Schema->>Schema: Add webhook-specific fields (reason, requiredFields)
    API->>Client: Return IncomingPaymentWebhook*Response
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants